package one.stand.controller;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.*;
import one.stand.response.AppointmentResponse;
import one.stand.response.CompanyPhotoResponse;
import one.stand.response.ProductsResponse;
import one.stand.response.ProductsTypeResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 公司配置图片管理
 * @author Administrator
 */
@RestController
@RequestMapping("crmPc/companyPhoto")
public class CompanyPhotoController extends BaseController {

    @PostMapping("selectCompanyPhotoPage")
    @ApiOperation(value = "分页查询企业配置图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "pageNum", value = "当前页", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "type", value = "1公司商品展示图片，2预约商品展示图片，3动态展示图片", paramType = "Integer"),
    })
    @ApiController(isLogin = true,company = true,card = true,paramClass = CompanyPhotoRequest.class )
    public ResultModel<Map<String, Object>> selectCompanyPhotoPage(@RequestAttribute CompanyPhotoRequest request) {
        return crmFegin.selectCompanyPhotoPage(request);
    }

    @PostMapping("selectCompanyPhoto")
    @ApiOperation(value = "查询企业配置图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "1公司商品展示图片，2预约商品展示图片，3动态展示图片", paramType = "Integer"),
    })
    @ApiController(isLogin = true,company = true,card = true,paramClass = CompanyPhotoRequest.class )
    public ResultModel<List<CompanyPhotoResponse>> selectCompanyPhoto(@RequestAttribute CompanyPhotoRequest request) {
        return crmFegin.selectCompanyPhoto(request);
    }

    @PostMapping("selectTypeNum")
    @ApiOperation(value = "广告图管理数量查询")
    @ApiController(isLogin = true,company = true,card = true,isParam = false)
    public ResultModel<List<Map<String, Object>>> selectTypeNum(CompanyPhotoRequest request, @RequestAttribute TokenRequest tokenRequest) {
        BeanUtils.copyProperties(tokenRequest,request);
        return crmFegin.selectTypeNum(request);
    }

    @PostMapping("insertCompanyPhoto")
    @ApiOperation(value = "新增企业配置图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "photoList", value = "图片集合", required = true, paramType = "List<String>"),
            @ApiImplicitParam(name = "type", value = "1公司商品展示图片，2预约商品展示图片，3动态展示图片",required = true,  paramType = "Integer"),
    })
    @ApiController(isLogin = true,company = true,card = true,isBoss = true,paramClass = CompanyPhotoRequest.class )
    public ResultModel<Boolean> insertCompanyPhoto(@RequestAttribute CompanyPhotoRequest request) {
        return crmFegin.insertCompanyPhoto(request);
    }

    @PostMapping("moveCompanyPhoto")
    @ApiOperation(value = "上移/下移企业配置图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "photoId", value = "图片id", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "type", value = "1公司商品展示图片，2预约商品展示图片，3动态展示图片", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "sortType", value = "1上移，2下移", required = true, paramType = "Integer"),
    })
    @ApiController(isLogin = true,company = true,card = true,isBoss = true,paramClass = CompanyPhotoRequest.class )
    public ResultModel<Boolean> moveCompanyPhoto(@RequestAttribute CompanyPhotoRequest request) {
        return crmFegin.moveCompanyPhoto(request);
    }

    @PostMapping("delCompanyPhoto")
    @ApiOperation(value = "删除企业配置图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "photoId", value = "图片id", required = true, paramType = "Integer"),
    })
    @ApiController(isLogin = true,company = true,card = true,isBoss = true,paramClass = CompanyPhotoRequest.class )
    public ResultModel<Boolean> delCompanyPhoto(@RequestAttribute CompanyPhotoRequest request) {
        return crmFegin.delCompanyPhoto(request);
    }

}
